package com.ego.product.feign;

import com.ego.common.util.Result;
import com.ego.product.to.coupon.BoundTo;
import com.ego.product.to.coupon.SkuReductionTo;
import com.ego.product.vo.coupon.SeckillVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.Valid;

/**
 * @program: ego
 * @description: 远程优惠卷服务
 * @author: KamTang
 * @create: 2022-11-22 17:42
 **/
@FeignClient("ego-coupon")
public interface CouponFeign {

    /**
     * 远程调用ego-coupon中的保存商品spu积分
     *
     * @param boundTo @see
     * @return 公共返回类
     * @see BoundTo
     */
    @PostMapping("/coupon/spu-bound/save")
    Result saveSpuBound(BoundTo boundTo);

    /**
     * 调用远程优惠服务端保存sku优惠
     *
     * @param skuReductionTo @see
     * @return 公共返回类
     * @see SkuReductionTo
     */
    @PostMapping("/coupon/sku-full-reduction/save-info")
    Result saveSkuReduction(SkuReductionTo skuReductionTo);

    /**
     * 获取近期的秒杀商品
     * @return @see
     * @see Result
     */
    @GetMapping("/seckill/currentSeckillSku")
    Result getCurrentSeckillSku();

    /**
     * 获取秒杀商品信息 —— 用于前端展示商品是否参与秒杀
     * @param skuId skuId
     * @return @see
     * @see Result
     */
    @GetMapping("/seckill/sku/{skuId}")
    Result getSeckillSku(@PathVariable("skuId") Long skuId);

    /**
     * 商品秒杀
     * @param seckillVo @see
     * @return 公共返回类
     * @see SeckillVo
     */
    @PostMapping("/seckill/kill")
    Result kill(@Valid @RequestBody SeckillVo seckillVo);
}
